<?php


namespace app\admin\controller;


use app\admin\model\MessageAgentHouse as MessageAgentHouseModel;
use app\admin\model\MessageSystem as MessageSystemModel;
use app\common\controller\AdminController;
use think\Exception;

/**
 * 智能选房消息
 * Class MessageAgentHouse
 * @package app\admin\controller
 */
class MessageAgentHouse extends AdminController {

    protected $levelConfig = [
        1 => ['getlist'],
        2 => ['del'],
        4 => [],
        8 => []
    ];

    /**
     * 列表
     * @return false|string
     */
    public function getList() {
        try {
            $params = $this->checkParams('');
            if ($params === false) return $this->resErr();
            $list = MessageAgentHouseModel::getList($params);
            return $this->resData('success', $list);
        } catch (Exception $e) {
            return $this->resErr($e->getMessage(), $e->getCode());
        }
    }


    /**
     * 删除
     * @return false|string
     */
    public function del() {
        try {
            $params = $this->checkParams('id');
            if ($params === false) return $this->resErr();
            $res = MessageAgentHouseModel::del($params);
            if (!$res) return $this->resErr();
            else return $this->resData('操作成功', []);
        } catch (Exception $e) {
            return $this->resErr($e->getMessage(), $e->getCode());
        }
    }


}